<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsf/composite"
	xmlns:p="http://primefaces.org/ui">

<ui:decorate template="/jsp/WEB/pageLayout.xhtml">
	<ui:define name="centro">
		<h:form id="form">
	
			<!-- ************************************************************************ -->
			<!-- ** Dados dos pedidos -->
			<!-- ************************************************************************ -->
			<p:panel id="ListPed" header="Listagem Pedidos">

				<f:facet name="actions">
					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
						<h:outputText styleClass="ui-icon ui-icon-print" title="Imprimir" />
						<p:printer target="tabelaUsu" />
					</h:commandLink>

					<h:commandLink
						styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default"
						style="width:16px;heigh:16px;">
						<p:graphicImage style=" margin-top:1px;margin-left:2px"
							title="Exportar relatório para excel" url="/imagens/ui-xls.png"></p:graphicImage>
						<p:dataExporter type="xls" target="tabelaUsu"
							fileName="Listagem de Pedidos" />
					</h:commandLink>

				</f:facet>

				<p:dataTable id="tabelaUsu" value="#{RelatorioBean.rel}" var="rel"
					widgetVar="relTable" rowIndexVar="rowIndex"
					emptyMessage="Nenhum registro encontrado" style="margin-top: 40px;"
					paginator="true" rows="20" rowsPerPageTemplate="10,20,30,40,50"
					filteredValue="#{RelatorioBean.relFiltrado}">


					<f:facet name="header">
						<p:outputPanel>
							<h:outputText value="Buscar todos os campos:" />
							<p:inputText id="globalFilter" onkeyup="PF('relTable').filter()"
								style="width:150px" placeholder="Digite a palavra" />
						</p:outputPanel>
					</f:facet>

					<p:column filterBy="#{rel.idPedido}" sortBy="idPedido"
						headerText="Nº Pedido" filterMatchMode="contains">
						<h:outputText value="#{rel.idPedido}" />
					</p:column>

					<p:column filterBy="#{rel.nomeUsu}" sortBy="nomeUsu"
						headerText="Usuário" filterMatchMode="contains">
						<h:outputText value="#{rel.nomeUsu}" />
					</p:column>

					<p:column filterBy="#{rel.descMerc}" sortBy="descMerc"
						headerText="Descrição" filterMatchMode="contains">
						<h:outputText value="#{rel.descMerc}" />
					</p:column>

					<p:column filterBy="#{rel.qtde}" sortBy="qtde"
						headerText="Quantidade" filterMatchMode="contains">
						<h:outputText value="#{rel.qtde}" />
					</p:column>

					<p:column  sortBy="data" headerText="Data">
						<h:outputText value="#{rel.data}">
							<f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy" />
						</h:outputText>
					</p:column>

					<p:column filterBy="#{rel.hora}" sortBy="hora" headerText="Hora"
						filterMatchMode="contains">
						<h:outputText value="#{rel.hora}" />
					</p:column>

				</p:dataTable>
			</p:panel>

		</h:form>
	</ui:define>
</ui:decorate>

</html>